package com.imut.lagain.entity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;

import java.time.LocalDateTime;

/**
 * 用户实体类
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("user")
public class User {
    private static final Logger log = LoggerFactory.getLogger(User.class);

    
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    
    /**
     * 微信用户唯一标识
     */
    @NotBlank(message = "openid不能为空")
    @Size(max = 128, message = "openid长度不能超过128个字符")
    @TableField("openid")
    private String openid;
    
    /**
     * 微信开放平台唯一标识
     */
    @Size(max = 128, message = "unionid长度不能超过128个字符")
    @TableField("unionid")
    private String unionid;
    
    /**
     * 微信昵称
     */
    @Size(max = 100, message = "昵称长度不能超过100个字符")
    @TableField("nickname")
    private String nickname;
    
    /**
     * 微信头像URL
     */
    @Size(max = 500, message = "头像URL长度不能超过500个字符")
    @TableField("avatar_url")
    private String avatarUrl;
    
    /**
     * 手机号（加密存储）
     */
    @Size(max = 20, message = "手机号长度不能超过20个字符")
    @TableField("phone")
    private String phone;
    
    /**
     * 邮箱地址
     */
    @Size(max = 100, message = "邮箱长度不能超过100个字符")
    @TableField("email")
    private String email;
    
    /**
     * 创建时间
     */
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;
    
    /**
     * 更新时间
     */
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
    
    /**
     * 是否活跃(1-活跃, 0-禁用)
     */
    @TableField("is_active")
    private Boolean isActive = true;
    
    /**
     * 是否删除(1-已删除, 0-未删除)
     */
    @TableLogic
    @TableField("is_deleted")
    private Boolean isDeleted = false;
    
    /**
     * 删除时间
     */
    @TableField("delete_time")
    private LocalDateTime deleteTime;
    public Long getId() {
        return id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }
    
    public Boolean getIsDeleted() {
        return isDeleted;
    }
    
    public void setIsDeleted(Boolean isDeleted) {
        this.isDeleted = isDeleted;
    }
    
    public LocalDateTime getDeleteTime() {
        return deleteTime;
    }
    
    public void setDeleteTime(LocalDateTime deleteTime) {
        this.deleteTime = deleteTime;
    }
    
    public String getEmail() {
        return email;
    }
    
    public void setEmail(String email) {
        this.email = email;
    }
    
    public String getNickname() {
        return nickname;
    }
    
    public void setNickname(String nickname) {
        this.nickname = nickname;
    }
    
    public String getPhone() {
        return phone;
    }
    
    public void setPhone(String phone) {
        this.phone = phone;
    }
    
    public String getOpenid() {
        return openid;
    }
    
    public void setOpenid(String openid) {
        this.openid = openid;
    }
    
    public String getUnionid() {
        return unionid;
    }
    
    public void setUnionid(String unionid) {
        this.unionid = unionid;
    }
    
    public String getAvatarUrl() {
        return avatarUrl;
    }
    
    public void setAvatarUrl(String avatarUrl) {
        this.avatarUrl = avatarUrl;
    }
    
    public LocalDateTime getCreateTime() {
        return createTime;
    }
    
    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }
    
    public LocalDateTime getUpdateTime() {
        return updateTime;
    }
    
    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }
    
    public Boolean getIsActive() {
        return isActive;
    }
    
    public void setIsActive(Boolean isActive) {
        this.isActive = isActive;
    }
}
